home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Almathera Ten Pack 3: CDPD 3
/
Almathera Ten on Ten - Disc 3: CDPD3.iso
/
scope
/
101-125
/
scopedisk125
/
usmap
/
domap
< prev
next >
Wrap
Text File
|
1995-03-19
|
4KB
|
193 lines
setblack 1
load 1,"usmap1" :rem read visible map
load 2,"usmap2" :rem read button mask
rem create button table array
array 500,2
table=100 :rem location of button table
gosub 980 :rem go read in the button table
new 3,1 :rem dup a copy of main screen (for highlighting)
copy 1,3
abort 0 :rem disable mouse abort
fade 1,-1,0 :rem reveal screen
pointer 1 :rem turn pointer on
demo=0
8 gosub 950 :rem start up in demo mode
goto 111 :rem exited demo mode
10
blitdest -1
dissolve 3,0,0,0,0,-1,-1,3000 :rem dissolve to original map
111
if demo=0:gosub 940:endif :rem get mouse input (with timeout )
demo=0
gosub 900 :rem determine which button clicked
if butcount=0:goto 10:endif :rem no button clicked
gosub 920 :rem highlight the selection
pause 2
if butcount=49:end:endif :rem exit button
if butcount=50:goto 8:endif :rem demo button
rem create area for information text
pen 1,7
rect 74,54,254,154
pen 1,23
rect 70,50,250,150
rem build state data file name
string "state",$(0)
@(5)=48+butcount/10 :rem add 10s digit
@(6)=48+butcount%10 :rem add 1s digit
@(7)=0 :rem end of name string
center 1 :rem center the text
pen 1,0 :rem pen color
rem open state data file
mode=0
open mode,$(0)
if mode=0 :rem data file not found
drawmode 0 :rem no background color
move 0,90
text "No data file"
move 0,110
text "on this state"
drawmode -1
12
gosub 940 :rem check for mouse click (w/timeout)
goto 10 :rem dissolve the selection away now
endif
vert=70 :rem y location for text
11
read v,$(0),80 :rem get a line from data file
if v=-1
close :rem end of file, no more data
goto 12
endif
move 0,vert :rem position on screen
drawmode 0 :rem no background color
text $(0) :rem display the data line
drawmode -1
vert=vert+14 :rem down to next line
goto 11 :rem read next line
rem determine button clicked
900
blitdest 2 :rem select button mask image
getpen pcolor,x,y :rem get color of pixel from mask
blitdest -1 :rem back to normal
butcount=0 :rem start at beginning of table
901
t=table+butcount*butsize
if @(t)=-1:butcount=0:return:endif :rem no more buttons
butcount=butcount+1 :rem check next button
rem x,y and color all must match
if x>@(t) & y>@(t+1) & x<@(t+2) & y<@(t+3) & pcolor=@(t+4)
return :rem we found our button
endif
goto 901
rem highlight the selection
920
t=table+(butcount-1)*butsize :rem locate button in table
rem get button parameters
xa=@(t):ya=@(t+1):xb=@(t+2):yb=@(t+3):pcolor=@(t+4)
x=@(t+5):y=@(t+6)
952
blitdest 2 :rem output to mask buffer
pen 1,0 :rem clear the button to color 0
getpen bcl,x,y :rem remember old color so we can restore later
fill 1,x,y
rem make a blank screen of color 31 to use as highlighting
new 5,-1
blitdest 5
pen 0,31
clear
blitdest -1 :rem output back to screen
pen 0,0
stencil 5,2,0 :rem stencil in the highlight
pen 1,bcl
blitdest 2 :rem output to mask buffer
fill 1,x,y :rem recolor in the button
blitdest -1 :rem output back to screen
free 5 :rem done with highlight screen
return
rem check for mouse input with timeout
940
demo=0
timeout=100
941
ifmouse x,y
if x=-1
pause 1
timeout=timeout-1
if timeout=0:gosub 950:return:endif :rem do demo
goto 941
endif
return
rem do demo & attract mode
950
demo=1 :rem signal demo mode
lastpic=-1
959
z=1+?48 :rem select a state at random
if z=lastpic:goto 959:endif :rem same as last choice? re-pick
lastpic=z :rem remember so we don't select it next time
butcount=z
copy 3,1 :rem erase old selection by restoring screen
gosub 920 :rem highlight the new selection
ifmouse x,y
if x#-1 :rem mouse clicked to abort demo mode?
blitdest -1:copy 3,1:return :rem yep, exit
endif
pause 3
goto 959
980 rem read in the button data table
mode=0
open mode,"us.table"
if mode=0
print "can't find 'us.table' file"
end
endif
butsize=7 :rem size of table entry
t=table
4
read v,$(0),80 :rem read a table entry
if v=-1
print "premature end of file in 'us.table'"
end
endif
n=$(0) :rem convert to a number
@(t)=n :rem place in table
t=t+1 :rem next location
if n#-1:goto 4:endif :rem not end of table? go to 4
close :rem close file
return